{layout name="layout2" /}
<style>
    .layui-form-item .layui-input-inline{
        margin-top:10px;
    }
    .layui-form-label {
        color: #6a6f6c;
        width: 100px;
        line-height: 15px;
    }
    #container {
        margin-left: 130px;
        width: 60%;
        height: 60%;
    }
    .layui-input-block {
        margin-left: 130px;
    }
    .tips{
        color: red;
    }
    .unit-tips{
        float: left;
        display: block;
        padding: 9px 0!important;
        line-height: 20px;
        margin-right: 10px;
    }
    .goods{
        display: none;
    }
    .goods-li {
        float: left;
        opacity: 1;
        position: relative;
    }

    .goods-img {
        width: 80px;
        height: 80px;
        padding: 4px;
    }
    .goods-img-del-x {
        position: absolute;
        z-index: 100;
        top: -4px;
        right: -2px;
        width: 20px;
        height: 20px;
        font-size: 16px;
        line-height: 16px;
        color: #fff;
        text-align: center;
        cursor: pointer;
        background: hsla(0, 0%, 60%, .6);
        border-radius: 10px;
    }

    #image{
        left:110px;
    }




</style>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=E2WBZ-XPM3B-VTOUQ-NZQTD-KHBHT-ZYBVF"></script>
<div class="layui-form" lay-filter="layuiadmin-form-user" id="layuiadmin-form-user" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label"><span class="tips">*</span>姓名：</label>
        <div class="layui-input-block">
            <input type="text" name="dname" lay-verify="required" lay-verType="tips" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="tips">*</span>手机账号</label>
        <div class="layui-input-block">
            <input type="text" name="dmobile" lay-verify="required" lay-verType="tips" placeholder="请输入手机账号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="tips">*</span>用户类型：</label>
        <div class="layui-input-block">
            <select name="dtype" class="layui-input" >
                <option value="">请选择用户类型</option>
                <option value="1">配送员</option>
                <option value="2">司机</option>
                <!--            <option value="3">经销商</option>-->
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属站点:</label>
        <div class="layui-input-block">
            <select name="site_id" id="site_id">
                <option value="">请选择站点</option>
                {foreach $bottle_site_list as $val}
                <option value="{$val.id}">{$val.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">账号状态：</label>
        <div class="layui-input-block">
            <input type="radio" name="dstatus" value="1" title="正常" checked>
            <input type="radio" name="dstatus" value="2" title="禁用" >
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="add-user-submit" id="add-user-submit" value="确认">
    </div>
</div>
<script>
    layui.config({
        version:"{$front_version}",
        base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table','form','laydate'], function(){
        var $ = layui.$
            ,form = layui.form
            ,laydate = layui.laydate
            ,table = layui.table
        laydate.render({
            elem: '#reg_time'
            // ,format: 'yyyy-MM-dd H:i'
            ,type: 'datetime'
            ,trigger: 'click'
        });
        laydate.render({
            elem: '#order_last_time'
            // ,format: 'yyyy-MM-dd H:i'
            ,type: 'datetime'
            ,trigger: 'click'
        });
        //上传图片
        like.imageUpload('.goods-img-add', function (uri, element) {
            if(uri.length>1){
                layer.msg('最多最能选中1张图片');
                return;
            }
            var html = '<div class="goods-li">\n' +
                '<img class="goods-img" ' +
                'src="' + uri[0] + '">' +
                '<a class="goods-img-del-x">x</a>' +
                '</div>';
            element.prev().val(like.getUrlFileName(uri[0], '{$storageUrl}'));
            element.parent().append(html);
            element.css('display','none');
        }, true);
        //删除图片
        $(document).on('click', '.goods-img-del-x', function () {
            $(this).parent().siblings('input').val('');
            $(this).parent().prev().css('display','block');
            $(this).parent().remove();
        });
        //显示图片
        $(document).on('click', '.goods-img', function () {
            var image = $(this).attr('src');
            like.showImg(image,600);
        });

        //  删除按钮的显示与隐藏
        $(document).on('mouseover', '.goods-img', function () {
            $(this).next().show();
        });
        $(document).on('mouseout', '.goods-img', function () {
            $(this).next().hide();
        });
        $(document).on('mouseover', '.goods-img-del-x', function () {
            $(this).show();
        });
        $(document).on('mouseout', '.goods-img-del-x', function () {
            $(this).hide();
        });
    });
var map = new TMap.Map('container', {
  zoom: 14,
  center: new TMap.LatLng(39.986785, 116.301012),
});
var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
var markers = new TMap.MultiMarker({
  map: map,
  geometries: [],
});


function convert() {
  markers.setGeometries([]);
  // 将给定的地址转换为坐标位置
  geocoder
    .getLocation({ address: document.getElementById('address').value })
    .then((result) => {
      markers.updateGeometries([
        {
          id: 'main',
          position: result.result.location, // 将得到的坐标位置用点标记标注在地图上
        },
      ]);
      map.setCenter(result.result.location);

      // document.getElementById(
      //   'longitude'
      // ).value = result.result.location;
      document.getElementById(
        'latitude'
      ).value = result.result.location;
      
      // 显示坐标数值
    });
}
</script>